//
//  FGTemplateMessageCellData.m
//  lite
//
//  Created by feige on 2022/11/3.
//

#import "FGTemplateMessageCellData.h"

@interface FGTemplateMessageCellData()

@end

@implementation FGTemplateMessageCellData

- (instancetype)initWithDirection:(FGMsgDirection)direction {
    self = [super initWithDirection:direction];
    if (self) {
        
    }
    return self;
}

+ (NSString *)reuseIdentifier {
    return @"FGTemplateMessageCell";
}

- (CGSize)contentSize {
    
    CGFloat height = 200;
    
    NSInteger type = [self.templateData[@"type"] integerValue];
    
    switch (type) {
        case 1: // 兴趣
            height = 351;
            break;
        case 2: // 帮助
            height = 351;
            break;
        case 3: // 商品
            height = 112;
            break;
        case 4: // 活动
            height = 234;
            break;
        case 5: // 表单
        {
            CGFloat height = ((NSArray *)[self.templateData valueForKeyPath:@"data.fileds"]).count * 40 + 100;
            return CGSizeMake(230, height);
        } break;
    }
    
    return CGSizeMake(281, height);
}

@end
